Skip to content

Conversation

aharpervc
Copy link
Contributor

This PR adds support for declaring cursors on queries for SQL Server (docs)

Eg, this now parses correctly, which is the "A" example from documentation:

DECLARE vend_cursor CURSOR
    FOR SELECT * FROM Purchasing.Vendor
OPEN vend_cursor
FETCH NEXT FROM vend_cursor;

There was already basic support for SQL Server cursors. What was missing was detecting & parsing the for_query struct field, and not requiring the @ prefix for cursor names.

A new verified statement test was also added accordingly.

@aharpervc aharpervc marked this pull request as ready for review April 23, 2025 20:55
Copy link
Contributor

@iffyio iffyio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @aharpervc!
cc @alamb

@iffyio iffyio merged commit 7703fd0 into apache:main Apr 24, 2025
9 checks passed
aharpervc added a commit to aharpervc/datafusion-sqlparser-rs that referenced this pull request Apr 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants